package J3_24;

public class test2 {
    public enum TestEnum {
        RED,BLACK,GREEN,WHITE;
        public static void main(String[] args) {
//拿到枚举实例BLACK
            /*TestEnum testEnum = TestEnum.BLACK;
//拿到枚举实例RED
            TestEnum testEnum21 = TestEnum.RED;
            System.out.println(testEnum.compareTo(testEnum21));
            System.out.println(BLACK.compareTo(RED));
            System.out.println(RED.compareTo(BLACK));
        }*/
            TestEnum[] testEnum2 = TestEnum.values();
            for (int i = 0; i < testEnum2.length; i++) {
                System.out.println(testEnum2[i] + " " + testEnum2[i].ordinal());
            }
            System.out.println("=========================");
            System.out.println(TestEnum.valueOf("GREEN"));}
    }
}
